<!DOCTYPE html>
<html>
	<head>
		<title>管理系统登录界面(JinYuan Zhang)</title>
		<script type="application/x-javascript">
			addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); }
		</script>

		<script src="https://code.jquery.com/jquery-3.6.0.min.js" type="text/javascript"></script>
		<link href="css/style.css" rel="stylesheet" type="text/css" />
	</head>
	<body>
		<h1></h1>
		<h1></h1>
		<div class="two-forms">
			<div class="wrap">
				<h1></h1>
				<div class="login">
					<div class="login-info">
						<h3 style="color:pink">可视化中心登录界面</span></h3>
						<input
							type="text"
							class="text"
							value="hujiang"
							onfocus="this.value = '';"
							onblur="if (this.value == '') {this.value = 'User Name';}"
						/>
						<input
							type="password"
							value="111111"
							onfocus="this.value = '';"
							onblur="if (this.value == '') {this.value = 'Password';}"
						/>
						<div class="btns">
							<!-- 提交操作 -->
							<input style="color:pink;font-size: 22px;"type="submit" value="login" onclick="insertUser()" />
						</div>
					</div>
				</div>
				<div class="clear"></div>
			</div>
		</div>
		<script>
			function insertUser() {
				var user = {};
				user.userName = $(".text").val();
				user.password = $("[type=password]").val();
				//调用ajax函数，参数为ajax的配置属性对象
				$.ajax({
					url: "http://www.sfac.xyz/api/login",
					type: "post",
					contentType: "application/json",
					data: JSON.stringify(user),
					success: function (result) {
						if (result.status == 200) {
							alert(result.message);
							console.log(result.data);
							// 跳转到大数据模板
							window.location.href = "file:../index.html";
						} else {
							alert(result.message);
						}
					},
					error: function (erro) {
						console.log(erro);
					},
				});
			}
		</script>
	</body>
</html>
